var creammagstardiv = $(".cream_stars");

for (i = 0; i < creammagstardiv.length; i++) {
    var el = $("#" + creammagstardiv[i].id);
    el.css("background-position", 18 * el.attr("alt") + "px 0px");
    el.css("background-image", "url('/img/grey_all_creamstars.png')");
}

$(".cream_stars").mousemove(function(e){
    var left_offset_position = $(this).offset().left;
    $(this).css("background-position", e.pageX - left_offset_position + "px 0px");
    $(this).css("background-image", "url('/img/grey_all_creamstars.png')");
});

$(".cream_stars").mouseout(function(){
    $(this).css("background-position", 18 * $(this).attr("alt") + "px 0px");
    $(this).css("background-image", "url('/img/grey_all_creamstars.png')");
});

$(".cream_stars").click(function(){
    alert("Проголосовали");
});




